#include<iostream.h>
#include"matrix.h"
#include<time.h>


int main()
{
	int x,y,n;
	double det;
	clock_t start,stop;
	time_t begin,end;
	
		
	do
	{
		cout<<"\n\t\t M A I N    M E N U";
		cout<<"\n\t 1.  ADDITION";
		cout<<"\n\t 2.  SUBSTRACTION";
		cout<<"\n\t 3.  MULTIPLICATION";
		cout<<"\n\t 4.  GAUSSIAN ELIMINATION";
		cout<<"\n\t 5. EXIT";
		
		cout<<"\n\t Enter Your Choice : ";
		cin>>n;
		
		switch(n)
		{
			case 1 :{
				cout<<"\n Enter the order(rows, cols) : ";
			        cin>>x>>y;
	
	 		        matrix A(x,y), B(x,y), C(x,y);
				gen_matrix(A,B); 
				 	
				C=A+B;
				
				cout<<"\n Addition...\n";
				cout<<C;
				
				break;
				}
			
			case 2 :{
				 
				cout<<"\n Enter the order(rows, cols) : ";
			        cin>>x>>y;
	
	 		        matrix A(x,y), B(x,y), C(x,y);
				gen_matrix(A,B); 
				
				C=A-B;
				
				cout<<"\n Substraction...\n";
				cout<<C;
				
				break;
				}
				
			case 3 :{
				cout<<"\n Enter the order(rows, cols) : ";
			        cin>>x>>y;
	
	 		        matrix A(x,y), B(x,y), C(x,y);
				gen_matrix(A,B); 
				 	
				C=A*B;
				
				cout<<"\n Multiplication...\n";
				cout<<C;
				
				break;
				}
			
			
			case 4:{
				cout<<"\n Enter order of matrix(nxn) : ";
				cin>>x;

				matrix A(x,x),var(x,1),B(x,1);
				gen_matrix(A,B);
				 
				if(fabs(A.determinant())<0.0001)
				 	cout<<"\n Matrix is not invertible...\n";
				else
				{
				 	cout<<"\n Variable Matrix...\n";
				 	var=A.gaussian(B);
				 
				 	cout<<var;
				}
				 
				break;
				}
			
			
			case 5:cout<<"\n Terminated Successfully...\n";
				break;
			
		}
	}while(n!=5);
	
	return 0;
}
